//
//  MineContinueCell.m
//  ZPIOSEducation
//
//  Created by 董伟1 on 17/2/25.
//  Copyright © 2017年 mini1. All rights reserved.
//

#import "MineContinueCell.h"
#import "ZPSelectCurriculumCell.h"

@implementation MineContinueCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    dataArray = [[NSMutableArray  alloc] init];
    self.mainCollectionView.delegate = self;
    self.mainCollectionView.dataSource = self;
    self.mainCollectionView.scrollEnabled = NO;
    
    [self.mainCollectionView  registerNib:[UINib  nibWithNibName:@"ZPSelectCurriculumCell" bundle:nil] forCellWithReuseIdentifier:@"ZPSelectCurriculumCell"];
}

- (void)setContentCellWithDic:(NSDictionary  *)dictionary
{
    self.classNameLab.text = [NSString  stringWithFormat:@"%@",[dictionary  objectForKey:@"className"]];
    self.dateLab.text = [NSString  stringWithFormat:@"%@",[dictionary  objectForKey:@"time"]];
    self.addressLab.text = [NSString  stringWithFormat:@"%@   %@",[dictionary  objectForKey:@"teachName"],[dictionary  objectForKey:@"teacherName"]];
    self.moneyLab.text = [NSString  stringWithFormat:@"续报价:￥%@",[dictionary  objectForKey:@"needPay"]];
    
    [dataArray  removeAllObjects];
    if ([[dictionary  objectForKey:@"scheduleList"] isKindOfClass:[NSArray  class]]) {
        [dataArray  addObjectsFromArray:[dictionary  objectForKey:@"scheduleList"]];
    }
    [self.mainCollectionView  reloadData];
}

#pragma mark - UICollectionView Delegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [dataArray  count];
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake((SCREENWIDTH - 6 - 10 - 20 - 40) / 6 - 0.1, 48);
}

- (UICollectionViewCell  *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"ZPSelectCurriculumCell";
    ZPSelectCurriculumCell  *cell = (ZPSelectCurriculumCell  *)[collectionView  dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
    NSInteger  row = [indexPath  row];
    NSDictionary  *tempDic = [dataArray objectAtIndex:row];
    cell.date.text = [NSString  stringWithFormat:@"%@",[tempDic  objectForKey:@"date"]];
    cell.numberLab.text = [NSString  stringWithFormat:@"%@",[tempDic  objectForKey:@"sort"]];
    cell.numberLab.textColor = RGBACOLOR(18, 95, 137, 1.);
    
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    self.checkImv.highlighted = selected;
    // Configure the view for the selected state
}

@end
